/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"98275572-D98A-43DD-AA0F-FBC68A90E326"}
 */
function aceptar(event) {
	if (databaseManager.saveData())
	{
		globals.gAltaCtacte(null,1,concepto,importe,fecha_factura)
		databaseManager.setAutoSave(true)
		var $win = application.getWindow('ALTA_PAGOS')
		$win.hide()
		$win.destroy()
	}
	else
	{
		globals.DIALOGS.showErrorDialog('Error','Ocurrio un error','OK')
	}
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"78F307A2-3224-4D04-9ED7-62656964C5F2"}
 */
function cancelar(event) {
	databaseManager.revertEditedRecords()
	databaseManager.setAutoSave(true)
	var $win = application.getWindow('ALTA_PAGOS')
	$win.hide()
	$win.destroy()
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @private
 *
 * @properties={typeid:24,uuid:"29951859-6507-4EFB-94B5-6C7271D884F9"}
 */
function onShow(firstShow, event) {
	elements.fld_consorcio.requestFocus()
}

/**
 * Handle changed data.
 *
 * @param {Number} oldValue old value
 * @param {Number} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"01B35AB0-27D6-4A4C-8EC6-8D260AD81B65"}
 */
function onDataChangeCondPago(oldValue, newValue, event) {
	if (newValue == 2)
	{
		elements.grp_cheque.visible = true
	}
	else
	{
		nro_cheque = null
		elements.grp_cheque.visible = false
	}
	return true
}

/**
 * Handle changed data.
 *
 * @param {Number} oldValue old value
 * @param {Number} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"6BC161A7-6259-4BBD-82CC-7321C517D59C"}
 */
function onDataChangeImporte(oldValue, newValue, event) {
	importe_exp_a = newValue
	importe_exp_b = 0
	return true
}

/**
 * Handle changed data.
 *
 * @param {Number} oldValue old value
 * @param {Number} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"F0F3ED6F-72B7-4267-A6B6-97240A76CDA1"}
 */
function onProveedorDataChange(oldValue, newValue, event) {
	concepto = pagos_to_proveedores.razon_social + ' ' + pagos_to_proveedores.proveedores_to_tipos_proveedor.descripcion + ' ' + pagos_to_proveedores.concepto_modelo
	return true
}

/**
 * Handle changed data.
 *
 * @param {String} oldValue old value
 * @param {String} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"77D2F448-A9D5-4253-AA74-E2CE31438C34"}
 */
function onNro_facturaDataChange(oldValue, newValue, event) {
	concepto += ' F. ' + newValue
	return true
}

/**
 * Handle changed data.
 *
 * @param {Date} oldValue old value
 * @param {Date} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"6E6F34F1-8A66-4E03-9A23-FFF5286095FE"}
 */
function onFecha_facturaDataChange(oldValue, newValue, event) {
	concepto += ' ' + utils.dateFormat(newValue,'dd/MM/yyyy')
	return true
}

/**
 * Handle changed data.
 *
 * @param {String} oldValue old value
 * @param {String} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"0E44FCCF-2BB4-4922-B6CE-75886F4EAEAE"}
 */
function onNro_reciboDataChange(oldValue, newValue, event) {
	concepto += ' R. ' + newValue
	return true
}

/**
 * Handle changed data.
 *
 * @param {Number} oldValue old value
 * @param {Number} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"60BADB4C-ED8D-4A27-BA58-7E1E870F1F29"}
 */
function onCuotaDataChange(oldValue, newValue, event) {
	concepto += ' C.'+newValue
	return true
}

/**
 * Handle changed data.
 *
 * @param {Number} oldValue old value
 * @param {Number} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"E7A6C128-8725-418B-A8B4-EF426AF6F2F2"}
 */
function onCuotas_totalesDataChange(oldValue, newValue, event) {
	concepto += '/'+newValue
	return true
}
